<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/webjars/bootstrap/4.5.3/css/bootstrap.min.css">
    <script src="${pageContext.request.contextPath}/webjars/jquery/3.5.1/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/popper.js/1.16.0/popper.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/bootstrap/4.5.3/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/webjars/vue/2.6.11/vue.min.js"></script>
    <title>Title</title>
</head>
<body>

<div class="jumbotron">
    <H1>🐧 <spring:message code="i18n.title.test"/></H1>
    <h3><spring:message code="i18n.title.welcome" arguments="李,悠然" argumentSeparator=","/> </h3>
</div>

<div class="container">
    <nav class="navbar navbar-expand-sm bg-dark navbar-dark">
        <ul class="navbar-nav">
            <li class="nav-item">
                <a class="nav-link active" href="${pageContext.request.contextPath}">Home</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/test/iframe/01">iframe_01</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/test/ajax/01">ajax_01</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/test/ajax/02">ajax_02</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/test/json">JSON</a>
            </li>

            <li class="nav-item">
                <a class="nav-link" href="${pageContext.request.contextPath}/test/exception">exception</a>
            </li>
        </ul>

        <ul class="navbar-nav ml-auto">
            <li class="nav-item">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown1"
                        aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNavDropdown1">
                    <ul class="navbar-nav">
                        <li class="nav-item dropdown">
                            <a href="" class="nav-link dropdown-toggle" id="language" role="button"
                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><spring:message code="i18n.language"/></a>
                            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="language">
                                <a class="dropdown-item" href="${pageContext.request.contextPath}/test/home?locale=zh_cn">中文</a>
                                <a class="dropdown-item" href="${pageContext.request.contextPath}/test/home?locale=en_us">English</a>
                            </div>
                        </li>
                    </ul>
                </div>
            </li>
            <li class="nav-item">
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown2"
                        aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNavDropdown2">
                    <ul class="navbar-nav">
                        <li class="nav-item dropdown">
                            <a href="" class="nav-link dropdown-toggle" id="user" role="button"
                               data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">alex</a>
                            <div class="dropdown-menu dropdown-menu-right" aria-labelledby="user">
                                <a class="dropdown-item" href="#">个人中心</a>
                                <a class="dropdown-item" href="#">退出</a>
                            </div>
                        </li>
                    </ul>
                </div>
            </li>
        </ul>
    </nav>
</div>
<div class="container">
    <div class="row">
        <fmt:setBundle basename="i18n" var="lang"></fmt:setBundle>
        <fmt:message key="i18n.username" bundle="${lang}"></fmt:message>
        <br>
        <spring:message code="i18n.username"/>
        <spring:message code="i18n.password"/>
        <spring:message code="i18n.hello"/>
        <spring:message code="error.test"/>
        <spring:message code="error.only"/>
    </div>

    <div class="row">
        <form action="${pageContext.request.contextPath}/converter">
            user-string: <input type="text" name="user" placeholder="user string" value="alex alex亚历山大@126.com">
            <input type="submit">
        </form>
    </div>

    <div class="row">
        <form:errors path="*"></form:errors>
        <form action="${pageContext.request.contextPath}/test/user">
            <input type="text" name="name" value=""><br>
            <input type="text" name="email" value="alex@126.com"><br>
            <input type="text" name="salary" value="123665.5"><br>
            <input type="text" name="birth" value="1999-12-13"><br>
            <input type="submit">
        </form>
    </div>

    <div class="row">
        <form action="${pageContext.request.contextPath}/test/user"><br>
            <input type="text" name="name" value="lucy"><br>
            <input type="text" name="email" value="alex@126.com"><br>
            <input type="text" name="salary" value="asd"><br>
            <input type="text" name="birth" value="1999-12-13"><br>
            <input type="submit">
        </form>
    </div>

    <div class="row">
        <form action="${pageContext.request.contextPath}/test/upload" method="post" enctype="multipart/form-data">
            <input type="file" name="file">
            <input type="submit">
        </form>
    </div>

    <div class="row">
        <form action="${pageContext.request.contextPath}/test/upload/do" method="post" enctype="multipart/form-data">
            <input type="file" name="file">
            <input type="text" name="desc" value="file upload from user">
            <input type="submit">
        </form>
    </div>



    <div class="jumbotron"></div>
</div>
</body>
</html>
